package com.itrus.ica.sign;

import com.itrus.ica.IcaClientBase;
import com.itrus.ica.IcaConnection;
import com.itrus.ica.IcaUnavailable;
import java.io.IOException;
import java.util.LinkedHashMap;
import org.apache.commons.logging.Log;

public class SignClient extends IcaClientBase
{
  public SignDataResult signData(String paramString1, String paramString2, String paramString3, byte[] paramArrayOfByte)
    throws IcaUnavailable
  {
    SignDataResult localSignDataResult = new SignDataResult();
    if (paramString1 == null)
      paramString1 = "SHA1";
    if (paramString2 == null)
    {
      localSignDataResult.setReturnCode("A002");
      localSignDataResult.setExtMessage("缺少必要参数:SIGNCERTSERIAL");
      return localSignDataResult;
    }
    if (paramArrayOfByte == null)
    {
      localSignDataResult.setReturnCode("A002");
      localSignDataResult.setExtMessage("缺少必要参数:SIGNSOURCEDATA");
      return localSignDataResult;
    }
    LinkedHashMap localLinkedHashMap1 = new LinkedHashMap();
    LinkedHashMap localLinkedHashMap2 = new LinkedHashMap();
    localLinkedHashMap1.put("DOOPERATE", "DATASIGN".getBytes());
    localLinkedHashMap1.put("SIGNALG", paramString1.getBytes());
    localLinkedHashMap1.put("SIGNCERTSERIAL", paramString2.toUpperCase().getBytes());
    if (paramString3 != null)
      localLinkedHashMap1.put("SIGNCERTPUBKEYMD5HASH", paramString3.toUpperCase().getBytes());
    localLinkedHashMap1.put("SIGNSOURCEDATA", paramArrayOfByte);
    IcaConnection localIcaConnection = null;
    try
    {
      localIcaConnection = getConnection();
      long l = localIcaConnection.request(localLinkedHashMap1, localLinkedHashMap2);
      localSignDataResult.setReturnCode(l);
      if (l == 0L)
      {
        localSignDataResult.setSuccess(true);
        localSignDataResult.setSignRetData((byte[])localLinkedHashMap2.get("SIGNRETDATA"));
      }
      if (localIcaConnection != null)
        localIcaConnection.close();
      this.log.debug(localSignDataResult.getMessage());
      return localSignDataResult;
    }
    catch (IOException localIOException)
    {
      while (true)
      {
        localSignDataResult.setReturnCode(1L);
        if (localIcaConnection != null)
          localIcaConnection.close();
      }
    }
    finally
    {
      if (localIcaConnection != null)
        localIcaConnection.close();
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.itrus.ica.sign.SignClient
 * JD-Core Version:    0.6.2
 */